package pl.edu.agh.gronoMining.frequentSubgraphFinder.frequentSearcher.subgraph;

import java.util.List;
import java.util.Set;

import pl.edu.agh.gronoMining.frequentSubgraphFinder.graph.GraphException;

/**
 * Represents start node subgraph. 
 */
public interface StartNodeSubgraph {

	/**
	 * @return DFS code describes all this subgraph.
	 */
	public DFSCode getAsDfs();
	
	/**
	 * Mark this subgraph as active subgraph. There can only be one active subgraph. Active subgraph has
	 * different methods for 'performMove()' and 'undoLastMove()'
	 */
	public void markAsActive();
	
	/**
	 * generates list of possible moves. Uses inputGraph, strategy and edge markers
	 * @param dfs dfs of this subgraph
	 * @return list of possible moves
	 */
	public List<SubgraphMove> getPossibleMoves(DFSCode dfs, Set<DFSCode> resultDfsSet);
	
	/**
	 * If possible, performs a move in this subgraph. After this move is put to stack to be use in 'undoLastMove()' method. 
	 * @param move move to perform
	 * @return true if move was successful, false if move is not possible
	 * @throws GraphException
	 */
	public boolean performMove(SubgraphMove move) throws GraphException;
	
	/**
	 * Undo last move of this subgraph. If you call this method N times, N last moves will be undone.
	 * @throws GraphException
	 */
	public void undoLastMove() throws GraphException;
	
	/**
	 * Marks an edge as frequent or unfrequent.
	 * @param isFrequent
	 */
	public void markLastMoveEdge(boolean isFrequent);
	
	/**
	 * Marks an edge as frequent or unfrequent, if current graph is the same as graph described as dfs code.
	 * @param isFrequent
	 * @param dfs
	 */
	public void markLastMoveEdge(boolean isFrequent, DFSCode dfs);
	
}
